<?php

//$a = $_POST["a"];
$a = $_GET["a"];
echo $a;
echo "<br/>";

//$b = $_POST["b"];
$b = $_GET["b"];
echo $b;
echo "<br/>$b";


echo "你好";

$ip = "mysql:host=127.0.0.1;";
$name = "root";
$pwd = "root";
$conn = new PDO($ip, $name, $pwd);

$conn->exec("set names utf8;");

$conn->exec("use mydb;");

$sql = "insert into student(name,sex) values('$a','$b')";
$pSql = $conn->prepare($sql);
$pSql->execute();


$sql = "select * from student";
$pSql = $conn->prepare($sql);
$ok = $pSql->execute();
//var_dump($pSql->fetch());


echo json_encode($pSql->fetchAll());

header("Content-Type: text/html; charset=utf-8");
